package com.example.tests;

public class ContactData implements Comparable<ContactData>{
		private String firstName;
        private String lastName;
        private String address;
        private String homeTelephone;
        private String mobileTelephone;
        private String workTelephone;
        private String email;
        private String secondEmail;
        private String dayBirthday;
        private String monthBirthday;
        private String yearBirthday;
        private String secondAddress;
        private String secondHomeTelephone;
        private String stringToSort = firstName + " " + lastName;
        

        public ContactData() {
        }
        
        @Override
    	public int hashCode() {
    		final int prime = 31;
    		int result = 1;
    		result = prime * result
    				+ ((stringToSort == null) ? 0 : stringToSort.hashCode());
    		return result;
    	}

    	@Override
    	public boolean equals(Object obj) {
    		if (this == obj)
    			return true;
    		if (obj == null)
    			return false;
    		if (getClass() != obj.getClass())
    			return false;
    		ContactData other = (ContactData) obj;
    		if (stringToSort == null) {
    			if (other.stringToSort != null)
    				return false;
    		} else if (!stringToSort.equals(other.stringToSort))
    			return false;
    		return true;
    	}

		@Override
		public int compareTo(ContactData other) {
			return this.stringToSort.toLowerCase().compareTo(other.stringToSort.toLowerCase());
		}

		@Override
		public String toString() {
			return "ContactData [firstname=" + firstName + "]";
		}

		public ContactData withFirstName(String firstName) {
			this.firstName = firstName;
			return this;
		}

		public ContactData withLastName(String lastName) {
			this.lastName = lastName;
			return this;
		}

		public ContactData withAddress(String address) {
			this.address = address;
			return this;
		}

		public ContactData withHomeTelephone(String homeTelephone) {
			this.homeTelephone = homeTelephone;
			return this;
		}

		public ContactData withMobileTelephone(String mobileTelephone) {
			this.mobileTelephone = mobileTelephone;
			return this;
		}

		public ContactData withWorkTelephone(String workTelephone) {
			this.workTelephone = workTelephone;
			return this;
		}

		public ContactData withEmail(String email) {
			this.email = email;
			return this;
		}

		public ContactData withSecondEmail(String secondEmail) {
			this.secondEmail = secondEmail;
			return this;
		}

		public ContactData withSecondAddress(String secondAddress) {
			this.secondAddress = secondAddress;
			return this;
		}

		public ContactData withSecondHomeTelephone(String secondHomeTelephone) {
			this.secondHomeTelephone = secondHomeTelephone;
			return this;
		}

		public ContactData withDayBirthday(String dayBirthday) {
			this.dayBirthday = dayBirthday;
			return this;
		}

		public ContactData withMonthBirthdat(String monthBirthdat) {
			monthBirthday = monthBirthdat;
			return this;
		}

		public ContactData withYearBirthday(String yearBirthday) {
			this.yearBirthday = yearBirthday;
			return this;
		}

		public String getFirstName() {
			return firstName;
		}

		public String getLastName() {
			return lastName;
		}

		public String getAddress() {
			return address;
		}

		public String getHomeTelephone() {
			return homeTelephone;
		}

		public String getMobileTelephone() {
			return mobileTelephone;
		}

		public String getWorkTelephone() {
			return workTelephone;
		}

		public String getEmail() {
			return email;
		}

		public String getSecondEmail() {
			return secondEmail;
		}

		public String getDayBirthday() {
			return dayBirthday;
		}

		public String getMonthBirthday() {
			return monthBirthday;
		}

		public String getYearBirthday() {
			return yearBirthday;
		}

		public String getSecondAddress() {
			return secondAddress;
		}

		public String getSecondHomeTelephone() {
			return secondHomeTelephone;
		}

		public String getStringToSort() {
			return stringToSort;
		}
		
}
